﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharpDiary.Core.Controls;
using SharpDiary.Core.ORMapping;
using SharpDiary.Core.Utility;

namespace SharpDiary.Note
{
    public partial class NoteInfoListControl : ListControlBase
    {
        public NoteInfoListControl()
        {
            InitializeComponent();
        }

        public override void ShowItems()
        {
            base.ShowItems();

            int summaryTextMaxLength = int.Parse(UserSettings.GetInstance().GetSettingValue("SummaryTextMaxLength", "20"));

            List<NoteInfo> notes = NoteInfo.SelectAll<NoteInfo>();
            foreach (NoteInfo note in notes)
            {
                NoteInfoListItemControl item = new NoteInfoListItemControl();
                item.SummaryTextMaxLength = summaryTextMaxLength;
                item.Note = note;

                AddItem(item);
            }
        }
    }
}
